package com.bwie.realtime.jtp.dwd.log.function;

 import com.bwie.realtime.jtp.dwd.log.bean.PageViewBean;
import org.apache.flink.api.common.functions.ReduceFunction;

public class PageViewReportReduceFunction implements ReduceFunction<PageViewBean> {

    @Override
    public PageViewBean reduce(PageViewBean tmp, PageViewBean bean) throws Exception {
//        增量计算:各个指标值相加
        tmp.setPvCount(tmp.getPvCount()+bean.getPvCount());
        tmp.setPvDuringTime(tmp.getPvDuringTime()+bean.getPvDuringTime());
        tmp.setUvCount(tmp.getUvCount()+bean.getUvCount());
        tmp.setSessionCount(tmp.getSessionCount()+bean.getSessionCount());

//        返回结果:
        return tmp;


    }
}
